package min.chapter.threet;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanSeparateAcquisition
{
    public static void main(String[] args)
    {
        String[] configLocation = new String[] {"BeanSeparate.xml"};
        AbstractApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
        
        context.registerShutdownHook();
        BeanSeparate executor = context.getBean("executor", BeanSeparate.class);
        executor.addUnit(new BeanSeparateWorkUnit());
        executor.addUnit(new BeanSeparateWorkUnit());
        executor.addUnit(new BeanSeparateWorkUnit());

        BeanSeparateWorker worker = context.getBean("workerBean", BeanSeparateWorker.class);
        worker.work(new BeanSeparateWorkUnit());
        worker.work(new BeanSeparateWorkUnit());
    }
}
